<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>会员中心-一览网</title>
    <link rel="stylesheet" href="css/common.css">
    <link rel="stylesheet" href="css/member.css">
    <script type="text/javascript" src="js/jquery-3.4.1.min.js"></script>
    <script type="text/javascript" src="js/layui/layui.all.js"></script>
</head>
<body>
<form novalidate="novalidate" id="new_address" action="http://www.buysellchem.com/member/account/create_address" accept-charset="UTF-8" method="post">
    <input type="hidden" name="_token" value="uPm8czm4d7Fg6QzZBbMaKawSKydIPC3UOk0MmSZB">
    <input name="utf8" type="hidden" value="✓">
    <input type="hidden" name="method" id="method" value="edit">
    <input type="hidden" name="address[district]" id="address_district" value="小店区">
    <input type="hidden" name="address[province]" id="address_province" value="山西省">
    <input type="hidden" name="address[city]" id="address_city" value="太原市">
    <input type="hidden" name="address[id]" id="address_id" value="2653">
    <table class="kqy_table">
        <tbody>
        <tr>
            <td class="t1"><span class="red mr10">*</span>所在地区</td>
            <td><input class="form_input wd300" id="full_address" name="full_address" placeholder="请输入邮箱" type="text" value="山西省/太原市/小店区"></td>
        </tr>
        <tr>
            <td class="t1"><span class="red mr10">*</span>详细地址</td>
            <td>
                <input class="form_input wd300" id="address_address" name="address[address]" placeholder="建议您如实填写详细收货地址，例如街道名称，门牌号码，楼层和房间号等信息" type="text" value="人民路华夏大厦16楼">
            </td>
        </tr>
        <tr>
            <td class="t1"><span class="red mr10">*</span>收货人</td>
            <td>
                <input class="form_input wd300" id="address_name" name="address[name]" placeholder="请输入您的收货人名字" type="text" value="伏焕凌">
            </td>
        </tr>
        <tr>
            <td class="t1"><span class="red mr10">*</span>联系电话</td>
            <td>
                <input class="form_input wd300" id="address_mobile" name="address[mobile]" placeholder="请输入您的联系电话" type="text" value="15968033987">
            </td>
        </tr>
        <tr>
            <td colspan="2" align="center"><button class="submit_btn wdp50" type="button" onclick="javascript:void(0);" id="btn_edit_address">确认</button></td>
        </tr>
        </tbody>
    </table>
</form>
<script type="text/javascript">
    $("#btn_edit_address").click(function(){

        if($("#address_province").val()=="" ||  $("#address_city").val()=="" ||  $("#address_district").val()=="" ){
            layer.alert('请选择完整的省市区!',{
                skin: 'layui-layer-lan',
                anim: 4
            });
            return false;
        }

        if($.trim($("#address_address").val())==''){
            layer.alert('请填写详细地址!',{
                skin: 'layui-layer-lan',
                anim: 4
            });
            return false;
        }
        if($.trim($("#address_name").val())==''){
            layer.alert('请填写收货人!',{
                skin: 'layui-layer-lan',
                anim: 4
            });
            return false;
        }
        if($.trim($("#address_mobile").val())==''){
            layer.alert('请填写联系电话!',{
                skin: 'layui-layer-lan',
                anim: 4
            });
            return false;
        }

        $.ajax({
            url: $("#new_address").attr('action'),
            data: $("#new_address").serializeArray(),
            type: 'post',
            cache: false,
            dataType: 'json',
            success: function (data) {
                layer.alert(data.msg,{
                    skin: 'layui-layer-lan',
                    anim: 4
                },function () {
                    window.location.href = "http://www.buysellchem.com/member/account/transaction";
                });
                return false;
            },
            error: function () {
                layer.msg('系统异常，请联系客服人员！', {icon: 2});
            }
        });

    });
</script>
</body>
</html>